package cn.findviewbydream.evil.app.service.impl

import cn.findviewbydream.evil.app.dao.LoginDAO
import cn.findviewbydream.evil.app.service.LoginService
import cn.findviewbydream.evil.main.entity.EmployeeEntity
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import javax.servlet.http.HttpSession

/********************************************
 * 工程名：MealOrder
 * 包名：cn.findviewbydream.evil.app.service.impl
 * 时间：16-12-24
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：登录实现类
 ********************************************/
@Service("loginService")
class LoginServiceImpl(@Autowired private val loginDAO: LoginDAO) : LoginService
{
    override fun login(session: HttpSession, id: String, name: String): EmployeeEntity?
    {
        Thread.sleep(1000)
        val employee = loginDAO.selectEmployeeByIdName(id, name)
        session.setAttribute("employee", employee)
        session.setAttribute("WEBSOCKET_USERID", employee.employeeId)
        return employee
    }
}